
#include <sys/cdefs.h>
#include "atomic_op_namespace.h"

#include <sys/types.h>
#include <sys/atomic.h>

#define atomic_load_n(n,b) \
uint ## b ## _t __atomic_load_ ## n(volatile uint ## b ## _t *, int); \
uint ## b ## _t \
__atomic_load_ ## n(volatile uint ## b ## _t *ptr, int memmodel) \
{ \
	uint## b ##_t val; \
	membar_enter(); \
	val = *ptr; \
	membar_exit(); \
	return val; \
}

atomic_load_n(1, 8)
atomic_load_n(2, 16)
atomic_load_n(4, 32)
#ifdef	__HAVE_ATOMIC_CAS_64_UP
atomic_load_n(8, 64)
#endif
